// 引入Service和请求头ServiceName
import { Service, ServiceName } from '@/network/http.js'
import store from '@/store/index.js' // 引入store

const publicapi = {
  /**
      * 获取堆场信息数据
      */
  getYardData(params) {
    return Service.get(
      `/${ServiceName}/api/external/yard/querybyid?id=${params}`
    )
  },
  /**
     * 修改堆场信息
     */
  changeYardData(params) {
    store.commit('changeStatus', true)
    return Service.put(
      `/${this.$ServiceName}/api/external/yard/update`, { params }
    )
  },
  /**
     * 新增堆场信息
     */
  addYardData(params) {
    store.commit('changeStatus', true)
    return Service.post(
      `/${this.$ServiceName}/api/external/yard/insert`, { params }
    )
  },
  /**
     * 删除堆场信息
     */
  deleteYardData(params) {
    return Service.delete(
      `/${this.$ServiceName}/api/external/yard/insert?id=${params}`
    )
  }
}

export default publicapi
